package com.wizinno.android.urineflow.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.wizinno.android.urineflow.R;
import com.wizinno.android.urineflow.activity.MainActivity;
import com.wizinno.android.urineflow.constant.CommonControl;
import com.wizinno.android.urineflow.constant.FragmentNoConstant;

public class HomeRightFragment extends BaseFragment {
    public HomeRightFragment() {
        setNo(FragmentNoConstant.HOME_RIGHT);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initData() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_home_right, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        MainActivity mainActivity = (MainActivity) getActivity();
        mainActivity.findViewById(R.id.iv_check_start).setOnClickListener(v -> {
            //检查USB通讯是否正常
            if (CommonControl.INSTANCE.isUsbNormal) {
                mainActivity.toChecking();
            } else {
                Toast.makeText(mainActivity, R.string.error_tip, Toast.LENGTH_SHORT).show();
            }
        });
    }
}